package weibo4android;

import weibo4android.http.Response;
import weibo4android.org.json.JSONException;
import weibo4android.org.json.JSONObject;

/**
 * @author Gerald.xv at gmail.com
 * @version 创建时间：2011-6-1 下午10:59:38
 * 类说明
 */
public class Address extends WeiboResponse implements java.io.Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 609231617689657792L;
	private String provName;
	private String cityName;
	private String cityCode;
	private String districtName;
	private String street;

	Address(Response res)throws WeiboException{
		super(res);
		
		 init(res.asJSONObject());
	
	}
	 private void init(JSONObject json) throws WeiboException {
			
			try{
				provName=json.getString("prov_name");
				cityName=json.getString("city_name");
				cityCode=json.getString("city");
				districtName=json.getString("district_name");
				street=json.getString("street");
				
			}catch(JSONException je){
				throw new WeiboException(je.getMessage() + ":" + json.toString(), je);
			}
		
	}

	public String getProvName() {
		return provName;
	}

	public void setProvName(String provName) {
		this.provName = provName;
	}

	public String getCityName() {
		return cityName;
	}

	public void setCityName(String cityName) {
		this.cityName = cityName;
	}

	public String getCityCode() {
		return cityCode;
	}

	public void setCityCode(String cityCode) {
		this.cityCode = cityCode;
	}

	public String getDistrictName() {
		return districtName;
	}

	public void setDistrictName(String districtName) {
		this.districtName = districtName;
	}

	public String getStreet() {
		return street;
	}

	public void setStreet(String street) {
		this.street = street;
	}
}
